package cn.tedu.oop2;
/**本类用于体会多态如何统一调用标准*/
public class TestFruit {
    public static void main(String[] args) {
        Fruit f = new Fruit();
        Apple a = new Apple();
        Banana b = new Banana();
        get(a);//get(new Apple())
        get(b);
        get(f);
    }
    public static void get(Fruit a){  //Fruit a = new Apple()
       a.clean();
    }
}
class Fruit{
    public void clean(){
        System.out.println("水果要洗洗再吃");
    }
}
class Apple extends Fruit{
    @Override
    public void clean(){
        System.out.println("苹果需要削皮");
    }
}
class Banana extends Fruit{
    @Override
    public void clean(){
        System.out.println("香蕉喜欢被扒皮");
    }
}
